#查资料发现，xlsx格式的文件其实内部是由多个文件组成的类似于文件夹的东西
#我希望能通过类似于访问文件夹的方式读取其中的文件

# import codecs

# excel_Path = "E:\\Study\\enjoy\\Python\\测试表.xlsx\\xl\\sharedStrings.xml"
# with codecs.open(excel_Path,"r","utf-8") as excel:
#     sheet = excel.readlines()
#     print(sheet)
#事实证明，直接把xlsx当文件读取是无效的做法

#在网络上查询到zipfile库
import zipfile

excel_Path = "测试表.xlsx"
if zipfile.is_zipfile(excel_Path): #is_zipfile() 判断是否似zip文件
   f = zipfile.ZipFile(excel_Path)
   files = f.namelist() #namelist() 返回zip压缩包中的所有文件
   for file in files:
       print(file)
   with f.open("xl/sharedStrings.xml","r") as mess:
       info = mess.readlines()
       for e in info:
           print(e.decode("utf-8"))

